import request from "@/network/request.js";

let headers = {
    'auth': localStorage.getItem('token')
}
let uid = JSON.parse(localStorage.getItem('userInfo')).id;

function AddOredr(datas) {
    datas.uid = uid
    datas.sid = 0
    let  data={data:JSON.stringify(datas)}
   
   return request({
       url: '/order/addorder',
       method: 'post',
       data:data,
       headers
   })
}
//用户所有订单接口
function GetOrderAllMes(){
    let data={
        uid:uid
    }
    return request({
        url: '/order/orderlist',
        method: 'post',
        data:data,
        headers
    })
}
//用户订单接口
function GetOrderMesByOid(data){
   data.uid=uid
    return request({
        url: '/order/getorder',
        method: 'post',
        data:data,
        headers
    })
}
//确认订单是否支付成功
function GetOrderConfirmed(data){
    data.uid=uid
     return request({
         url: '/order/OrderCheck',
         method: 'post',
         data:data,
         headers
     })
 }
 //修改订单状态
 function UpOrderStateByOid(data){
     return request({
         url: '/order/orderstatus',
         method: 'post',
         data:data,
         headers
     })
 }
export {AddOredr,GetOrderAllMes,GetOrderMesByOid,GetOrderConfirmed,UpOrderStateByOid}